LanguageExt.Core

LanguageExt.Core DataTypes Alternative Value Monads Validation

Contents

struct Validation <MonoidFail, FAIL, SUCCESS> Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

Like Either but collects the failed values

Parameters

type MonoidFail
type FAIL
type SUCCESS

Properties

property bool IsFail Source #

property bool IsSuccess Source #

property object Case Source #

Reference version for use in pattern-matching

Validation Succ   = result is SUCCESS
Validation Fail   = result is FAIL
Validation Bottom = result is mempty FAIL

Constructors

constructor Validation (IEnumerable<ValidationData<MonoidFail, FAIL, SUCCESS>> validationData) Source #

Ctor that facilitates serialisation

Methods

method void GetObjectData (SerializationInfo info, StreamingContext context) Source #

method IEnumerator<ValidationData<MonoidFail, FAIL, SUCCESS>> GetEnumerator () Source #

method Validation<MonoidFail, FAIL, SUCCESS> Success (SUCCESS success) Source #

Success constructor

method Validation<MonoidFail, FAIL, SUCCESS> Fail (FAIL fail) Source #

Fail constructor

method Validation<MonoidFail, FAIL, SUCCESS> Disjunction <SUCCESSB> (Validation<MonoidFail, FAIL, SUCCESSB> other) Source #

method ValidationContext<MonoidFail, FAIL, SUCCESS, Ret> Succ <Ret> (Func<SUCCESS, Ret> f) Source #

Fluent matching

method ValidationUnitContext<MonoidFail, FAIL, SUCCESS> Succ <Ret> (Action<SUCCESS> f) Source #

Fluent matching

method Ret Match <Ret> (Func<SUCCESS, Ret> Succ, Func<FAIL, Ret> Fail) Source #

Invokes the Succ or Fail function depending on the state of the Validation

Parameters

type Ret

Return type

param Succ

Function to invoke if in a Success state

param Fail

Function to invoke if in a Fail state

returns

The return value of the invoked function

method Ret Match <Ret> (Ret Succ, Func<FAIL, Ret> Fail) Source #

Returns Succ value or invokes Fail function depending on the state of the Validation

Parameters

type Ret

Return type

param Succ

Value to return if in a Success state

param Fail

Function to invoke if in a Fail state

returns

The return value of the invoked function

method Ret MatchUnsafe <Ret> (Func<SUCCESS, Ret> Succ, Func<FAIL, Ret> Fail) Source #

Invokes the Succ or Fail function depending on the state of the Validation

Parameters

type Ret

Return type

param Succ

Function to invoke if in a Success state

param Fail

Function to invoke if in a Fail state

returns

The return value of the invoked function

method Unit Match (Action<SUCCESS> Succ, Action<FAIL> Fail) Source #

Invokes the Succ or Fail action depending on the state of the Validation

Parameters

param Succ

Action to invoke if in a Success state

param Fail

Action to invoke if in a Fail state

returns

Unit

method Task<R2> MatchAsync <R2> (Func<SUCCESS, Task<R2>> SuccAsync, Func<FAIL, R2> Fail) Source #

Match the two states of the Validation and return a promise for a non-null R2.

Parameters

returns

A promise to return a non-null R2

method Task<R2> MatchAsync <R2> (Func<SUCCESS, Task<R2>> SuccAsync, Func<FAIL, Task<R2>> FailAsync) Source #

Match the two states of the Validation and return a promise for a non-null R2.

Parameters

returns

A promise to return a non-null R2

method SUCCESS IfFail (Func<SUCCESS> Fail) Source #

Executes the Fail function if the Validation is in a Fail state. Returns the Success value if the Validation is in a Success state.

Parameters

param Fail

Function to generate a Success value if in the Fail state

returns

Returns an unwrapped Success value

method SUCCESS IfFail (Func<FAIL, SUCCESS> FailMap) Source #

Executes the FailMap function if the Validation is in a Fail state. Returns the Success value if the Validation is in a Success state.

Parameters

param FailMap

Function to generate a Success value if in the Fail state

returns

Returns an unwrapped Success value

method SUCCESS IfFail (SUCCESS SuccessValue) Source #

Returns the SuccessValue if the Validation is in a Fail state. Returns the Success value if the Validation is in a Success state.

Parameters

param SuccessValue

Value to return if in the Fail state

returns

Returns an unwrapped Success value

method Unit IfFail (Action<FAIL> Fail) Source #

Executes the Fail action if the Validation is in a Fail state.

Parameters

param Fail

Function to generate a Success value if in the Fail state

returns

Returns an unwrapped Success value

method Unit IfSuccess (Action<SUCCESS> Success) Source #

Invokes the Success action if the Validation is in a Success state, otherwise does nothing

Parameters

param Success

Action to invoke

returns

Unit

method FAIL IfSuccess (FAIL FailValue) Source #

Returns the FailValue if the Validation is in a Success state. Returns the Fail value if the Validation is in a Fail state.

Parameters

param FailValue

Value to return if in the Fail state

returns

Returns an unwrapped Fail value

method FAIL IfSuccess (Func<FAIL> Success) Source #

Returns the result of Success() if the Validation is in a Success state. Returns the Fail value if the Validation is in a Fail state.

Parameters

param Success

Function to generate a Fail value if in the Success state

returns

Returns an unwrapped Fail value

method FAIL IfSuccess (Func<SUCCESS, FAIL> SuccessMap) Source #

Returns the result of SuccessMap if the Validation is in a Success state. Returns the Fail value if the Validation is in a Fail state.

Parameters

param SuccessMap

Function to generate a Fail value if in the Success state

returns

Returns an unwrapped Fail value

method string ToString () Source #

Return a string representation of the Validation

Parameters

returns

String representation of the Validation

method int GetHashCode () Source #

Returns a hash code of the wrapped value of the Validation

Parameters

returns

Hash code

method int CompareTo (object obj) Source #

method bool Equals (object obj) Source #

Equality check

Parameters

param obj

Object to test for equality

returns

True if equal

method Lst<SUCCESS> SuccessToList () Source #

Project the Validation into a Lst

method Arr<SUCCESS> SuccessToArray () Source #

Project the Validation into an immutable array

method Lst<FAIL> FailToList () Source #

Project the Validation into a Lst

method Arr<FAIL> FailToArray () Source #

Project the Validation into an immutable array R

method Seq<SUCCESS> ToSeq () Source #

Convert Validation to sequence of 0 or 1 right values

method Seq<SUCCESS> SuccessToSeq () Source #

Convert Validation to sequence of 0 or 1 success values

method Seq<FAIL> FailToSeq () Source #

Convert Validation to sequence of 0 or 1 success values

method Seq<SUCCESS> SuccessAsEnumerable () Source #

Project the Validation success into a Seq

method Seq<FAIL> FailAsEnumerable () Source #

Project the Validation fail into a Seq

method Eff<SUCCESS> ToEff (Func<FAIL, Error> Fail) Source #

method Aff<SUCCESS> ToAff (Func<FAIL, Error> Fail) Source #

method Option<SUCCESS> ToOption () Source #

Convert the Validation to an Option

method Either<FAIL, SUCCESS> ToEither () Source #

Convert the Validation to an EitherUnsafe

method EitherUnsafe<FAIL, SUCCESS> ToEitherUnsafe () Source #

Convert the Validation to an EitherUnsafe

method TryOption<SUCCESS> ToTryOption () Source #

Convert the Validation to an TryOption

method int CompareTo (Validation<MonoidFail, FAIL, SUCCESS> other) Source #

CompareTo override

method int CompareTo (SUCCESS success) Source #

CompareTo override

method int CompareTo (FAIL fail) Source #

CompareTo override

method bool Equals (SUCCESS success) Source #

Equality override

method bool Equals (FAIL fail) Source #

Equality override

method bool Equals (Validation<MonoidFail, FAIL, SUCCESS> other) Source #

Equality override

method int Count () Source #

Counts the Validation

Parameters

param self

Validation to count

returns

1 if the Validation is in a Success state, 0 otherwise.

method Unit Iter (Action<SUCCESS> Success) Source #

Iterate the Validation action is invoked if in the Success state

method Unit BiIter (Action<SUCCESS> Success, Action<FAIL> Fail) Source #

Iterate the Validation action is invoked if in the Success state

method bool ForAll (Func<SUCCESS, bool> Success) Source #

Invokes a predicate on the value of the Validation if it's in the Success state

Parameters

type L

Fail

type R

Success

param self

Validation to forall

param Success

Predicate

returns

True if the Validation is in a Fail state. True if the Validation is in a Success state and the predicate returns True. False otherwise.

method bool BiForAll (Func<SUCCESS, bool> Success, Func<FAIL, bool> Fail) Source #

Invokes a predicate on the value of the Validation if it's in the Success state

Parameters

type L

Fail

type R

Success

param self

Validation to forall

param Success

Predicate

param Fail

Predicate

returns

True if Validation Predicate returns true

method S Fold <S> (S state, Func<S, SUCCESS, S> Success) Source #

Validation types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the Fail-identity of the operator), and a list, reduces the list using the binary operator, from Fail to Success:

Parameters

type S

Aggregate state type

param state

Initial state

param Success

Folder function, applied if structure is in a Success state

returns

The aggregate state

method S BiFold <S> (S state, Func<S, SUCCESS, S> Success, Func<S, FAIL, S> Fail) Source #

Validation types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the Fail-identity of the operator), and a list, reduces the list using the binary operator, from Fail to Success:

Parameters

type S

Aggregate state type

param state

Initial state

param Success

Folder function, applied if Validation is in a Success state

param Fail

Folder function, applied if Validation is in a Fail state

returns

The aggregate state

method bool Exists (Func<SUCCESS, bool> pred) Source #

Invokes a predicate on the value of the Validation if it's in the Success state

Parameters

type L

Fail

type R

Success

param self

Validation to check existence of

param pred

Predicate

returns

True if the Validation is in a Success state and the predicate returns True. False otherwise.

method bool BiExists (Func<SUCCESS, bool> Success, Func<FAIL, bool> Fail) Source #

Invokes a predicate on the value of the Validation

Parameters

type L

Fail

type R

Success

param self

Validation to check existence of

param Success

Success predicate

param Fail

Fail predicate

method Validation<MonoidFail, FAIL, SUCCESS> Do (Action<SUCCESS> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Validation<MonoidFail, FAIL, Ret> Map <Ret> (Func<SUCCESS, Ret> mapper) Source #

Maps the value in the Validation if it's in a Success state

Parameters

type L

Fail

type R

Success

type Ret

Mapped Validation type

param self

Validation to map

param mapper

Map function

returns

Mapped Validation

method Validation<MonoidFail, FAIL, Ret> BiMap <Ret> (Func<SUCCESS, Ret> Success, Func<FAIL, Ret> Fail) Source #

Bi-maps the value in the Validation if it's in a Success state

Parameters

type L

Fail

type R

Success

type RRet

Success return

param self

Validation to map

param Success

Success map function

param Fail

Fail map function

returns

Mapped Validation

method Validation<MonoidRet, Ret, SUCCESS> MapFail <MonoidRet, Ret> (Func<FAIL, Ret> Fail) Source #

where MonoidRet : struct, Monoid<Ret>, Eq<Ret>

Maps the value in the Validation if it's in a Fail state

Parameters

type MonoidRet

Monad of Fail

type Ret

Fail return

param Fail

Fail map function

returns

Mapped Validation

method Validation<MonoidFail2, FAIL2, SUCCESS2> BiMap <MonoidFail2, FAIL2, SUCCESS2> (Func<SUCCESS, SUCCESS2> Success, Func<FAIL, FAIL2> Fail) Source #

where MonoidFail2 : struct, Monoid<FAIL2>, Eq<FAIL2>

Bi-maps the value in the Validation

Parameters

type MonoidFail2

Monad of Fail

type FAIL2

Fail return

type SUCCESS2

Success return

param Success

Success map function

param Fail

Fail map function

returns

Mapped Validation

method Validation<MonoidFail, FAIL, U> Select <U> (Func<SUCCESS, U> map) Source #

Maps the value in the Validation if it's in a Success state

Parameters

type L

Fail

type TR

Success

type UR

Mapped Validation type

param self

Validation to map

param map

Map function

returns

Mapped Validation

method Validation<MonoidFail, FAIL, U> Bind <U> (Func<SUCCESS, Validation<MonoidFail, FAIL, U>> f) Source #

method Validation<MonoidFail, FAIL, B> BiBind <B> (Func<SUCCESS, Validation<MonoidFail, FAIL, B>> Succ, Func<FAIL, Validation<MonoidFail, FAIL, B>> Fail) Source #

Bi-bind. Allows mapping of both monad states

method Validation<MonoidFail, FAIL, V> SelectMany <U, V> (Func<SUCCESS, Validation<MonoidFail, FAIL, U>> bind, Func<SUCCESS, U, V> project) Source #

Operators

operator < (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs < rhs

operator <= (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs <= rhs

operator > (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs > rhs

operator >= (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs >= rhs

operator == (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Equality operator override

operator != (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Non-equality operator override

operator | (Validation<MonoidFail, FAIL, SUCCESS> lhs, Validation<MonoidFail, FAIL, SUCCESS> rhs) Source #

Coalescing operator

operator true (Validation<MonoidFail, FAIL, SUCCESS> value) Source #

Override of the True operator to return True if the Validation is Success

operator false (Validation<MonoidFail, FAIL, SUCCESS> value) Source #

Override of the False operator to return True if the Validation is Fail

struct ValidationContext <MonoidFail, FAIL, SUCCESS, Ret> Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

Context for the fluent Either matching

Methods

method Ret Fail (Func<FAIL, Ret> fail) Source #

Fail match

Parameters

param Fail
returns

Result of the match

struct ValidationUnitContext <MonoidFail, FAIL, SUCCESS> Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

Context for the fluent Validation matching

Methods

method Unit Left (Action<FAIL> fail) Source #

class ValidationGuardExtensions Source #

Methods

method Validation<MonoidFail, FAIL, Unit> ToValidation <MonoidFail, FAIL> (this Guard<FAIL> ma) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, B> SelectMany <MonoidFail, FAIL, B> ( this Guard<FAIL> ma, Func<Unit, Validation<MonoidFail, FAIL, B>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, C> SelectMany <MonoidFail, FAIL, B, C> ( this Guard<FAIL> ma, Func<Unit, Validation<MonoidFail, FAIL, B>> bind, Func<Unit, B, C> project) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, Unit> SelectMany <MonoidFail, FAIL, A> ( this Validation<MonoidFail, FAIL, A> ma, Func<A, Guard<FAIL>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, C> SelectMany <MonoidFail, FAIL, A, C> ( this Validation<MonoidFail, FAIL, A> ma, Func<A, Guard<FAIL>> bind, Func<A, Unit, C> project) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

class Prelude Source #

Methods

method Validation<ERROR, A> Success <ERROR, A> (A value) Source #

Represents a successful operation

Parameters

type ERROR

Error type

type A

Value type

param value

Value

returns

Validation applicative

method Validation<MonoidError, ERROR, A> Success <MonoidError, ERROR, A> (A value) Source #

where MonoidError : struct, Monoid<ERROR>, Eq<ERROR>

Represents a successful operation

Parameters

type MonoidError

Monoid for collecting the errors

type ERROR

Error type

type A

Value type

param value

Value

returns

Validation applicative

method Validation<ERROR, A> Fail <ERROR, A> (ERROR value) Source #

Represents a failed operation

Parameters

type ERROR

Error type

type A

Value type

param value

Error value

returns

Validation applicative

method Validation<ERROR, A> Fail <ERROR, A> (Seq<ERROR> values) Source #

Represents a failed operation

Parameters

type ERROR

Error type

type A

Value type

param value

Error value

returns

Validation applicative

method Validation<MonoidError, ERROR, A> Fail <MonoidError, ERROR, A> (ERROR value) Source #

where MonoidError : struct, Monoid<ERROR>, Eq<ERROR>

Represents a failed operation

Parameters

type MonoidError

Monoid for collecting the errors

type ERROR

Error type

type A

Value type

param value

Error value

returns

Validation applicative

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, R> (this ValueTuple<Validation<MonoidFail, FAIL, A>> items, Func<A, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, B, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>> items, Func<A, B, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, B, C, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C> > items, Func<A, B, C, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, B, C, D, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D> > items, Func<A, B, C, D, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, B, C, D, E, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D>, Validation<MonoidFail, FAIL, E> > items, Func<A, B, C, D, E, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, B, C, D, E, F, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D>, Validation<MonoidFail, FAIL, E>, Validation<MonoidFail, FAIL, F> > items, Func<A, B, C, D, E, F, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> Apply <MonoidFail, FAIL, A, B, C, D, E, F, G, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D>, Validation<MonoidFail, FAIL, E>, Validation<MonoidFail, FAIL, F>, Validation<MonoidFail, FAIL, G> > items, Func<A, B, C, D, E, F, G, R> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<FAIL, R> Apply <FAIL, A, B, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>> items, Func<A, B, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C> > items, Func<A, B, C, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D> > items, Func<A, B, C, D, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E> > items, Func<A, B, C, D, E, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F> > items, Func<A, B, C, D, E, F, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G> > items, Func<A, B, C, D, E, F, G, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H> ) items, Func<A, B, C, D, E, F, G, H, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I> ) items, Func<A, B, C, D, E, F, G, H, I, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J> ) items, Func<A, B, C, D, E, F, G, H, I, J, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, K, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, N, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M>, Validation<FAIL, N> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, N, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M>, Validation<FAIL, N>, Validation<FAIL, O> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, R> f) Source #

method Validation<FAIL, R> Apply <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M>, Validation<FAIL, N>, Validation<FAIL, O>, Validation<FAIL, P> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, R> f) Source #

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, R> (this ValueTuple<Validation<MonoidFail, FAIL, A>> items, Func<A, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, B, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>> items, Func<A, B, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, B, C, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C> > items, Func<A, B, C, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, B, C, D, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D> > items, Func<A, B, C, D, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, B, C, D, E, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D>, Validation<MonoidFail, FAIL, E> > items, Func<A, B, C, D, E, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, B, C, D, E, F, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D>, Validation<MonoidFail, FAIL, E>, Validation<MonoidFail, FAIL, F> > items, Func<A, B, C, D, E, F, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<MonoidFail, FAIL, R> ApplyM <MonoidFail, FAIL, A, B, C, D, E, F, G, R> ( this ValueTuple< Validation<MonoidFail, FAIL, A>, Validation<MonoidFail, FAIL, B>, Validation<MonoidFail, FAIL, C>, Validation<MonoidFail, FAIL, D>, Validation<MonoidFail, FAIL, E>, Validation<MonoidFail, FAIL, F>, Validation<MonoidFail, FAIL, G> > items, Func<A, B, C, D, E, F, G, Validation<MonoidFail, FAIL, R>> f) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

method Validation<FAIL, R> ApplyM <FAIL, A, B, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>> items, Func<A, B, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C> > items, Func<A, B, C, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D> > items, Func<A, B, C, D, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E> > items, Func<A, B, C, D, E, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F> > items, Func<A, B, C, D, E, F, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, R> ( this ValueTuple< Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G> > items, Func<A, B, C, D, E, F, G, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H> ) items, Func<A, B, C, D, E, F, G, H, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I> ) items, Func<A, B, C, D, E, F, G, H, I, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J> ) items, Func<A, B, C, D, E, F, G, H, I, J, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, K, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, N, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M>, Validation<FAIL, N> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, N, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M>, Validation<FAIL, N>, Validation<FAIL, O> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Validation<FAIL, R>> f) Source #

method Validation<FAIL, R> ApplyM <FAIL, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, R> ( this ( Validation<FAIL, A>, Validation<FAIL, B>, Validation<FAIL, C>, Validation<FAIL, D>, Validation<FAIL, E>, Validation<FAIL, F>, Validation<FAIL, G>, Validation<FAIL, H>, Validation<FAIL, I>, Validation<FAIL, J>, Validation<FAIL, K>, Validation<FAIL, L>, Validation<FAIL, M>, Validation<FAIL, N>, Validation<FAIL, O>, Validation<FAIL, P> ) items, Func<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Validation<FAIL, R>> f) Source #

class ValidationData <MonoidFail, FAIL, SUCCESS> Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

Fields

field Validation.StateType State Source #

field SUCCESS Success Source #

field FAIL Fail Source #

Constructors

constructor ValidationData (Validation.StateType state, SUCCESS success, FAIL fail) Source #

class ValidationData <FAIL, SUCCESS> Source #

Fields

field Validation.StateType State Source #

field SUCCESS Success Source #

field Lst<FAIL> Fail Source #

Constructors

constructor ValidationData (Validation.StateType state, SUCCESS success, Lst<FAIL> fail) Source #

struct Validation <FAIL, SUCCESS> Source #

Like Either but collects the failed values

Parameters

type FAIL
type SUCCESS

Properties

property object Case Source #

Reference version for use in pattern-matching

Validation Succ   = result is SUCCESS
Validation Fail   = result is Seq<FAIL>
Validation Bottom = result is Seq<FAIL>.Empty

property bool IsFail Source #

property bool IsSuccess Source #

Constructors

constructor Validation (IEnumerable<ValidationData<FAIL, SUCCESS>> validationData) Source #

Ctor that facilitates serialisation

Methods

method void GetObjectData (SerializationInfo info, StreamingContext context) Source #

method IEnumerator<ValidationData<FAIL, SUCCESS>> GetEnumerator () Source #

method Validation<FAIL, SUCCESS> Disjunction <SUCCESSB> (Validation<FAIL, SUCCESSB> other) Source #

method Validation<FAIL, SUCCESS> Success (SUCCESS success) Source #

Success constructor

method Validation<FAIL, SUCCESS> Fail (Seq<FAIL> fail) Source #

Fail constructor

method ValidationContext<FAIL, SUCCESS, Ret> Succ <Ret> (Func<SUCCESS, Ret> f) Source #

Fluent matching

method ValidationUnitContext<FAIL, SUCCESS> Succ <Ret> (Action<SUCCESS> f) Source #

Fluent matching

method Ret Match <Ret> (Func<SUCCESS, Ret> Succ, Func<Seq<FAIL>, Ret> Fail) Source #

Invokes the Succ or Fail function depending on the state of the Validation

Parameters

type Ret

Return type

param Succ

Function to invoke if in a Success state

param Fail

Function to invoke if in a Fail state

returns

The return value of the invoked function

method Ret MatchUnsafe <Ret> (Func<SUCCESS, Ret> Succ, Func<Seq<FAIL>, Ret> Fail) Source #

Invokes the Succ or Fail function depending on the state of the Validation

Parameters

type Ret

Return type

param Succ

Function to invoke if in a Success state

param Fail

Function to invoke if in a Fail state

returns

The return value of the invoked function

method Unit Match (Action<SUCCESS> Succ, Action<Seq<FAIL>> Fail) Source #

Invokes the Succ or Fail action depending on the state of the Validation

Parameters

param Succ

Action to invoke if in a Success state

param Fail

Action to invoke if in a Fail state

returns

Unit

method Task<R2> MatchAsync <R2> (Func<SUCCESS, Task<R2>> SuccAsync, Func<Seq<FAIL>, R2> Fail) Source #

Match the two states of the Validation and return a promise for a non-null R2.

Parameters

returns

A promise to return a non-null R2

method Task<R2> MatchAsync <R2> (Func<SUCCESS, Task<R2>> SuccAsync, Func<Seq<FAIL>, Task<R2>> FailAsync) Source #

Match the two states of the Validation and return a promise for a non-null R2.

Parameters

returns

A promise to return a non-null R2

method SUCCESS IfFail (Func<SUCCESS> Fail) Source #

Executes the Fail function if the Validation is in a Fail state. Returns the Success value if the Validation is in a Success state.

Parameters

param Fail

Function to generate a Success value if in the Fail state

returns

Returns an unwrapped Success value

method SUCCESS IfFail (Func<Seq<FAIL>, SUCCESS> FailMap) Source #

Executes the FailMap function if the Validation is in a Fail state. Returns the Success value if the Validation is in a Success state.

Parameters

param FailMap

Function to generate a Success value if in the Fail state

returns

Returns an unwrapped Success value

method SUCCESS IfFail (SUCCESS SuccessValue) Source #

Returns the SuccessValue if the Validation is in a Fail state. Returns the Success value if the Validation is in a Success state.

Parameters

param SuccessValue

Value to return if in the Fail state

returns

Returns an unwrapped Success value

method Unit IfFail (Action<Seq<FAIL>> Fail) Source #

Executes the Fail action if the Validation is in a Fail state.

Parameters

param Fail

Function to generate a Success value if in the Fail state

returns

Returns an unwrapped Success value

method Unit IfSuccess (Action<SUCCESS> Success) Source #

Invokes the Success action if the Validation is in a Success state, otherwise does nothing

Parameters

param Success

Action to invoke

returns

Unit

method Seq<FAIL> IfSuccess (Seq<FAIL> FailValue) Source #

Returns the FailValue if the Validation is in a Success state. Returns the Fail value if the Validation is in a Fail state.

Parameters

param FailValue

Value to return if in the Fail state

returns

Returns an unwrapped Fail value

method Seq<FAIL> IfSuccess (Func<Seq<FAIL>> Success) Source #

Returns the result of Success() if the Validation is in a Success state. Returns the Fail value if the Validation is in a Fail state.

Parameters

param Success

Function to generate a Fail value if in the Success state

returns

Returns an unwrapped Fail value

method Seq<FAIL> IfSuccess (Func<SUCCESS, Seq<FAIL>> SuccessMap) Source #

Returns the result of SuccessMap if the Validation is in a Success state. Returns the Fail value if the Validation is in a Fail state.

Parameters

param SuccessMap

Function to generate a Fail value if in the Success state

returns

Returns an unwrapped Fail value

method string ToString () Source #

Return a string representation of the Validation

Parameters

returns

String representation of the Validation

method int GetHashCode () Source #

Returns a hash code of the wrapped value of the Validation

Parameters

returns

Hash code

method int CompareTo (object obj) Source #

method bool Equals (object obj) Source #

Equality check

Parameters

param obj

Object to test for equality

returns

True if equal

method Lst<SUCCESS> SuccessToList () Source #

Project the Validation into a Lst

method Arr<SUCCESS> SuccessToArray () Source #

Project the Validation into an immutable array

method Lst<FAIL> FailToList () Source #

Project the Validation into a Lst

method Arr<FAIL> FailToArray () Source #

Project the Validation into an immutable array R

method Seq<SUCCESS> ToSeq () Source #

Convert Validation to sequence of 0 or 1 right values

method Seq<SUCCESS> SuccessToSeq () Source #

Convert Validation to sequence of 0 or 1 success values

method Seq<FAIL> FailToSeq () Source #

Convert Validation to sequence of 0 or 1 success values

method Seq<SUCCESS> SuccessAsEnumerable () Source #

Project the Validation success into a Seq

method Seq<FAIL> FailAsEnumerable () Source #

Project the Validation fail into a Seq

method Eff<SUCCESS> ToEff (Func<Seq<FAIL>, Error> Fail) Source #

method Aff<SUCCESS> ToAff (Func<Seq<FAIL>, Error> Fail) Source #

method Option<SUCCESS> ToOption () Source #

Convert the Validation to an Option

method Either<Seq<FAIL>, SUCCESS> ToEither () Source #

Convert the Validation to an Either

method EitherUnsafe<Seq<FAIL>, SUCCESS> ToEitherUnsafe () Source #

Convert the Validation to an EitherUnsafe

method TryOption<SUCCESS> ToTryOption () Source #

Convert the Validation to an TryOption

method int CompareTo (Validation<FAIL, SUCCESS> other) Source #

CompareTo override

method int CompareTo (SUCCESS success) Source #

CompareTo override

method int CompareTo (Seq<FAIL> fail) Source #

CompareTo override

method bool Equals (SUCCESS success) Source #

Equality override

method bool Equals (Seq<FAIL> fail) Source #

Equality override

method bool Equals (Validation<FAIL, SUCCESS> other) Source #

Equality override

method int Count () Source #

Counts the Validation

Parameters

param self

Validation to count

returns

1 if the Validation is in a Success state, 0 otherwise.

method Unit Iter (Action<SUCCESS> Success) Source #

Iterate the Validation action is invoked if in the Success state

method Unit BiIter (Action<SUCCESS> Success, Action<FAIL> Fail) Source #

Iterate the Validation action is invoked if in the Success state

method bool ForAll (Func<SUCCESS, bool> Success) Source #

Invokes a predicate on the value of the Validation if it's in the Success state

Parameters

type L

Fail

type R

Success

param self

Validation to forall

param Success

Predicate

returns

True if the Validation is in a Fail state. True if the Validation is in a Success state and the predicate returns True. False otherwise.

method bool BiForAll (Func<SUCCESS, bool> Success, Func<FAIL, bool> Fail) Source #

Invokes either predicate on the value(s) of the Validation

Parameters

type L

Fail

type R

Success

param self

Validation to forall

param Success

Predicate

param Fail

Predicate

returns

True if Validation Predicate returns true

method S Fold <S> (S state, Func<S, SUCCESS, S> Success) Source #

Validation types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the Fail-identity of the operator), and a list, reduces the list using the binary operator, from Fail to Success:

Parameters

type S

Aggregate state type

param state

Initial state

param Success

Folder function, applied if structure is in a Success state

returns

The aggregate state

method S BiFold <S> (S state, Func<S, SUCCESS, S> Success, Func<S, FAIL, S> Fail) Source #

Validation types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the Fail-identity of the operator), and a list, reduces the list using the binary operator, from Fail to Success:

Parameters

type S

Aggregate state type

param state

Initial state

param Success

Folder function, applied if Validation is in a Success state

param Fail

Folder function, applied if Validation is in a Fail state

returns

The aggregate state

method bool Exists (Func<SUCCESS, bool> pred) Source #

Invokes a predicate on the value of the Validation if it's in the Success state

Parameters

type L

Fail

type R

Success

param self

Validation to check existence of

param pred

Predicate

returns

True if the Validation is in a Success state and the predicate returns True. False otherwise.

method bool BiExists (Func<SUCCESS, bool> Success, Func<FAIL, bool> Fail) Source #

Invokes a predicate on the value of the Validation

Parameters

type L

Fail

type R

Success

param self

Validation to check existence of

param Success

Success predicate

param Fail

Fail predicate

returns

True if the predicate returns True. False otherwise.

method Validation<FAIL, SUCCESS> Do (Action<SUCCESS> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Validation<FAIL, Ret> Map <Ret> (Func<SUCCESS, Ret> mapper) Source #

Maps the value in the Validation if it's in a Success state

Parameters

type L

Fail

type R

Success

type Ret

Mapped Validation type

param self

Validation to map

param mapper

Map function

returns

Mapped Validation

method Validation<FAIL, Ret> BiMap <Ret> (Func<SUCCESS, Ret> Success, Func<Seq<FAIL>, Ret> Fail) Source #

Bi-maps the value in the Validation if it's in a Success state

Parameters

type L

Fail

type R

Success

type RRet

Success return

param self

Validation to map

param Success

Success map function

param Fail

Fail map function

returns

Mapped Validation

method Validation<Ret, SUCCESS> MapFail <Ret> (Func<FAIL, Ret> Fail) Source #

Maps the value in the Validation if it's in a Fail state

Parameters

type Ret

Fail return

param Fail

Fail map function

returns

Mapped Validation

method Validation<FAIL2, SUCCESS2> BiMap <FAIL2, SUCCESS2> (Func<SUCCESS, SUCCESS2> Success, Func<FAIL, FAIL2> Fail) Source #

Bi-maps the value in the Validation

Parameters

type FAIL2

Fail return

type SUCCESS2

Success return

param Success

Success map function

param Fail

Fail map function

returns

Mapped Validation

method Validation<FAIL, U> Select <U> (Func<SUCCESS, U> map) Source #

Maps the value in the Validation if it's in a Success state

Parameters

type L

Fail

type TR

Success

type UR

Mapped Validation type

param self

Validation to map

param map

Map function

returns

Mapped Validation

method Validation<FAIL, U> Bind <U> (Func<SUCCESS, Validation<FAIL, U>> f) Source #

method Validation<FAIL, V> SelectMany <U, V> (Func<SUCCESS, Validation<FAIL, U>> bind, Func<SUCCESS, U, V> project) Source #

method Validation<FAIL, SUCCESS> Filter (Func<SUCCESS, bool> f) Source #

method Validation<FAIL, SUCCESS> Where (Func<SUCCESS, bool> f) Source #

Operators

operator < (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs < rhs

operator <= (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs <= rhs

operator > (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs > rhs

operator >= (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Comparison operator

Parameters

param lhs

The left hand side of the operation

param rhs

The right hand side of the operation

returns

True if lhs >= rhs

operator == (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Equality operator override

operator != (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Non-equality operator override

operator | (Validation<FAIL, SUCCESS> lhs, Validation<FAIL, SUCCESS> rhs) Source #

Coalescing operator

operator true (Validation<FAIL, SUCCESS> value) Source #

Override of the True operator to return True if the Validation is Success

operator false (Validation<FAIL, SUCCESS> value) Source #

Override of the False operator to return True if the Validation is Fail

struct ValidationContext <FAIL, SUCCESS, Ret> Source #

Context for the fluent Either matching

Methods

method Ret Fail (Func<Seq<FAIL>, Ret> fail) Source #

Fail match

Parameters

param Fail
returns

Result of the match

struct ValidationUnitContext <FAIL, SUCCESS> Source #

Context for the fluent Validation matching

Methods

method Unit Left (Action<Seq<FAIL>> fail) Source #

class ValidationSeqExtensions Source #

Methods

method Validation<FAIL, SUCCESS> Flatten <FAIL, SUCCESS> (this Validation<FAIL, Validation<FAIL, SUCCESS>> self) Source #

Flatten the nested Validation type

method Validation<MonoidFail, FAIL, SUCCESS> Flatten <MonoidFail, FAIL, SUCCESS> (this Validation<MonoidFail, FAIL, Validation<MonoidFail, FAIL, SUCCESS>> self) Source #

where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>

Flatten the nested Validation type

method IEnumerable<S> Successes <F, S> (this IEnumerable<Validation<F, S>> vs) Source #

Extract only the successes

Parameters

type F

Fail type

type S

Success type

param vs

Enumerable of validations

returns

Enumerable of successes

method IEnumerable<F> Fails <F, S> (this IEnumerable<Validation<F, S>> vs) Source #

Extract only the failures

Parameters

type F

Fail type

type S

Success type

param vs

Enumerable of validations

returns

Enumerable of failures

method Seq<S> Successes <F, S> (this Seq<Validation<F, S>> vs) Source #

Extract only the successes

Parameters

type F

Fail type

type S

Success type

param vs

Seq of validations

returns

Enumerable of successes

method Seq<F> Fails <F, S> (this Seq<Validation<F, S>> vs) Source #

Extract only the failures

Parameters

type F

Fail type

type S

Success type

param vs

Seq of validations

returns

Enumerable of failures

method IEnumerable<S> Successes <MonoidF, F, S> (this IEnumerable<Validation<MonoidF, F, S>> vs) Source #

where MonoidF : struct, Monoid<F>, Eq<F>

Extract only the successes

Parameters

type F

Fail type

type S

Success type

param vs

Enumerable of validations

returns

Enumerable of successes

method IEnumerable<F> Fails <MonoidF, F, S> (this IEnumerable<Validation<MonoidF, F, S>> vs) Source #

where MonoidF : struct, Monoid<F>, Eq<F>

Extract only the failures

Parameters

type F

Fail type

type S

Success type

param vs

Enumerable of validations

returns

Enumerable of failures

method Seq<S> Successes <MonoidF, F, S> (this Seq<Validation<MonoidF, F, S>> vs) Source #

where MonoidF : struct, Monoid<F>, Eq<F>

Extract only the successes

Parameters

type F

Fail type

type S

Success type

param vs

Seq of validations

returns

Enumerable of successes

method Seq<F> Fails <MonoidF, F, S> (this Seq<Validation<MonoidF, F, S>> vs) Source #

where MonoidF : struct, Monoid<F>, Eq<F>

Extract only the failures

Parameters

type F

Fail type

type S

Success type

param vs

Seq of validations

returns

Enumerable of failures

class ValidationSeqGuardExtensions Source #

Methods

method Validation<FAIL, Unit> ToValidation <FAIL> (this Guard<FAIL> ma) Source #

method Validation<FAIL, B> SelectMany <FAIL, B> ( this Guard<FAIL> ma, Func<Unit, Validation<FAIL, B>> f) Source #

method Validation<FAIL, C> SelectMany <FAIL, B, C> ( this Guard<FAIL> ma, Func<Unit, Validation<FAIL, B>> bind, Func<Unit, B, C> project) Source #

method Validation<FAIL, Unit> SelectMany <FAIL, A> ( this Validation<FAIL, A> ma, Func<A, Guard<FAIL>> f) Source #

method Validation<FAIL, C> SelectMany <FAIL, A, C> ( this Validation<FAIL, A> ma, Func<A, Guard<FAIL>> bind, Func<A, Unit, C> project) Source #

class Prelude Source #

Methods

method Validation<FAIL, SUCCESS> flatten <FAIL, SUCCESS> (this Validation<FAIL, Validation<FAIL, SUCCESS>> self) Source #

Flatten the nested Validation type